package com.gitee.theskyzero.data.db.mybatis;

import com.gitee.theskyzero.data.db.Test;
import com.gitee.theskyzero.data.db.mybatis.mapper.TestMapper;
import com.sun.istack.NotNull;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/data/db/mybatis")
@MapperScan(basePackageClasses = {TestMapper.class})
public class MybatisRestController {

    @Autowired
    TestMapper testMapper;

    @GetMapping("/{id")
    public Test findById(@NotNull @PathVariable Long id) {
        return testMapper.findById(id);
    }
}
